<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>json</title>
</head>
<body>
    <script>
        // js对象转json字符串 注：自动忽略方法
        var obj1 = {
          name:"宝强",
          age : 18,
          address : "河南",
          show:function () {
            console.log(this.name + "--" + this.age + "--" + this.address)
          }
        }
        var str1 = JSON.stringify(obj1);
        console.log(str1);

        // json字符串转js对象
        var parse = JSON.parse(str1);
        console.log(parse);

        // eval json字符串转对象 慎用危险
        var eval1 = eval({"name":"宝强","age":18,"address":"河南","score" : "99.9"})
        console.log(eval1);
    </script>
</body>
</html>